package component
{
	
	import baseInterface.component.IbaseComponent;
	import baseInterface.container.IBaseSkinContainer;
	import baseInterface.functional.Iable;
	import baseInterface.functional.IenableAble;
	
	import component.change.ADmultAbleMng;
	import component.change.ADmultStateChange;
	
	import flash.display.Sprite;
	import flash.utils.Dictionary;
	
	import skin.BaseSkin;
	

	/**
	 *基础 组件 
	 * @author Chita
	 * 
	 */
	public class ADbaseComponent extends Sprite implements IbaseComponent,IenableAble
	{
		private var _skins:ADmultStateChange=new ADmultStateChange;
		private var _ables:ADmultAbleMng=new ADmultAbleMng;
		public function ADbaseComponent()
		{
//			this.mouseEnabled=false;
			init();
		}
		protected function init():void
		{
			_skins.setContainer(this);
		}
		
		public function defineState(index:int, stateFunc:Function):void
		{
			// TODO Auto Generated method stub
			_skins.defineState(index,stateFunc);
		}
		
		public function set state(value:int):void
		{
			// TODO Auto Generated method stub
			_skins.state=value
		}
		
		public function get state():int
		{
			// TODO Auto Generated method stub
			return _skins.state;
		}
	
		public function get stateCout():int
		{
			// TODO Auto Generated method stub
			return _skins.stateCout
			return 0;
		}
		
		public function getAbleIndex(ab:Iable):int
		{
			return _ables.getAbleIndex(ab)
		}
		
		public function SetSkinByIndex(index:int, skin:BaseSkin):IBaseSkinContainer
		{
			// TODO Auto Generated method stub
			return _skins.setSkinByIndex(index,skin);
		}
		
		public function getskinContainerByindex(index:int):IBaseSkinContainer
		{
			// TODO Auto Generated method stub
			return _skins.getskinContainerByindex(index);
		}
		
		public function get skinLen():int
		{
			// TODO Auto Generated method stub
			return _skins.skinLen;
		}
		public	function getStateFuncIndex(stateFunc:Function):int
		{
			return _skins.getStateFuncIndex(stateFunc);
		}
		public function changeAble(type:Class, value:Boolean):void
		{
			_ables.setenableAble(type,value);			
		}
		public function registerAble(value:Iable):void
		{
			if(!_ables.addAble(value))return;
			_skins.defineState(_skins.stateCout,value.stateFunc);
			value.setTarget(this);
			value.isable=true
		}
		
		
	}
}